#include "Render.h"

Render GRender;

void Render::FillRGBA( int x, int y, int w, int h, int r, int g, int b, int a )
{
	g_pSurface.DrawSetColor( r, g, b, a );
	g_pSurface.DrawFilledRect( x, y, w, h );
}

void Render::CornerBox( int x, int y, int lw, int w, int h, int r, int g, int b, int a )
{
	// Upper Left
	FillRGBA( x, y, 3, lw, 0, 0, 0, a );
	FillRGBA( x, y, lw, 3, 0, 0, 0, a );
	FillRGBA( x + 1, y + 1, 1, lw - 2, r, g, b, a );
	FillRGBA( x + 1, y + 1, lw - 2, 1, r, g, b, a );

	// Upper Right
	FillRGBA( x + w + lw - 3, y, 3, lw, 0, 0, 0, a );
	FillRGBA( x + w, y, lw, 3, 0, 0, 0, a );
	FillRGBA( x + w + lw - 2, y + 1, 1, lw - 2, r, g, b, a );
	FillRGBA( x + w + 1, y + 1, lw - 2, 1, r, g, b, a );

	// Downer Left
	FillRGBA( x, y + h - lw, 3, lw, 0, 0, 0, a );
	FillRGBA( x, y + h - 3, lw, 3, 0, 0, 0, a );
	FillRGBA( x + 1, y + h - lw + 1, 1, lw - 2, r, g, b, a );
	FillRGBA( x + 1, y + h - 2, lw - 2, 1, r, g, b, a );

	// Downer Right
	FillRGBA( x + w + lw - 3, y + h - lw, 3, lw, 0, 0, 0, a );
	FillRGBA( x + w, y + h - 3, lw, 3, 0, 0, 0, a );
	FillRGBA( x + w + lw - 2, y + h - lw + 1, 1, lw - 2, r, g, b, a );
	FillRGBA( x + w + 1, y + h - 2, lw - 2, 1, r, g, b, a );
}

void Render::OutlineRGBA( int x, int y, int w, int h, int lw, int r, int g, int b, int a )
{
	FillRGBA( x + lw, y, w - lw, lw, r, g, b, a );
	FillRGBA( x, y, lw, h, r, g, b, a );
	FillRGBA( x + w - lw, y + lw, lw, h - lw, r, g, b, a );
	FillRGBA( x + lw, y + h - lw, w - lw - lw, lw, r, g, b, a);
}

void Render::LineRGBA(int x0, int y0, int x1, int y1, int r, int g, int b, int a)
{
	g_pSurface.DrawSetColor(r, g, b, a);
	g_pSurface.DrawLine(x0, y0, x1, y1);
}